<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>山羊の前端小窝</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .shell{
            width: 100%;
            height: 100vh;
        }
        .img{
            width: 100%;
            height: 100%;
            background-image: url('./img.jpg');
            background-repeat:repeat-x;
            background-position: 0 -600px;
        }
    </style>
</head>
<body>
    <div class="shell">
        <div class="img"></div>
    </div>
    <script>
        const img = document.querySelector('.img')
        img.addEventListener('mouseenter',function(e){
            this.x=e.clientX
            this.y=e.clientY
        })
        img.addEventListener('mousemove',function(e){
            this._x=e.clientX
            this._y=e.clientY
            const disx = this._x-this.x
            const disy = this._y-this.y
            const movex = disx*2
            const movey = -600+disy/1.6
            img.style.backgroundPosition=`${movex}px ${movey}px`
        })
    </script>
</body>
</html>